package com.company.hrmadmin.modules.entity.dto.kafka;

import java.util.HashMap;
import java.util.Map;

/**
 * Kafka 的 Event 实体类
 * 这里采用了链式变成的思想，统一将 Set 方法返回值设置为 Event
 *
 * @author Song, Wei
 * Date: 2022/4/22 17:35
 */
public class Event {
    /**
     * 消息队列主题，对应于申请编号，统一设置为 yyyMMddHHmm+六位随机数
     */
    private String topic;
    /**
     * 用户ID
     */
    private int applyUserId;
    /**
     * 申请类型
     */
    private int applyType;
    /**
     * 审批人ID
     */
    private int auditUserId;
    /**
     * 数据
     */
    private final Map<String, Object> data = new HashMap<>();

    public String getTopic() {
        return topic;
    }

    public Event setTopic(String topic) {
        this.topic = topic;
        return this;
    }

    public int getApplyUserId() {
        return applyUserId;
    }

    public Event setApplyUserId(int applyUserId) {
        this.applyUserId = applyUserId;
        return this;
    }

    public int getApplyType() {
        return applyType;
    }

    public Event setApplyType(int applyType) {
        this.applyType = applyType;
        return this;
    }

    public int getAuditUserId() {
        return auditUserId;
    }

    public Event setAuditUserId(int auditUserId) {
        this.auditUserId = auditUserId;
        return this;
    }

    public Map<String, Object> getData() {
        return data;
    }

    public Event setData(String key, Object value) {
        this.data.put(key, value);
        return this;
    }

    @Override
    public String toString() {
        return "Event{" +
                "topic='" + topic + '\'' +
                ", applyUserId=" + applyUserId +
                ", applyType=" + applyType +
                ", auditUserId=" + auditUserId +
                ", data=" + data +
                '}';
    }
}
